package com.hkg.springcloud.controller;

import com.hkg.newbackage.MySlfeRule;
import com.hkg.springcloud.ResultUtil.CommonResult;
import com.hkg.springcloud.entities.Payment;
import com.hkg.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName : OrderFeignController
 * @Author : 坏老爷
 * @Date: 2020-04-01 15:59
 */
@RestController
@Slf4j
@RibbonClient(name = "CLOUD-PAYMENT-SERVICE", configuration = MySlfeRule.class)   //实现随机分发服务（默认轮询模式）
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @PostMapping("/payment/query/{id}")
    public CommonResult<Payment> a(@PathVariable("id") Long id) {
        return paymentFeignService.queryPaymentById(id);
    }

}
